<%--
  Created by IntelliJ IDEA.
  User: yjc
  Date: 2020/11/3
  Time: 21:31
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="/layui/css/layui.css"/>
    <script type="text/javascript" src="/layui/layui.js"></script>
    <script type="text/javascript" src="/js/jquery-3.2.1.js"></script>
</head>
<body>
<div id="tree1"></div>
<script type="text/javascript">
    layui.use('tree',function(){
        var tree=layui.tree;
        //显示(生成)树节点
        var treeInst= tree.render({
            elem:'#tree1',
            data:[]
        })
        $.ajax({
            url:'major/depts1',
            type:'post',
            dataType:'json',
            success:function (resp) {
                treeInst.reload({
                    data:resp//将处理后的结果赋值给data(数据源)
                })
            }
        })
    })
</script>
</body>
</html>
